﻿using ControllerStudy.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ControllerStudy.Controllers
{
    public class ParameterController : Controller
    {
        //
        // GET: /Parameter/
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult UseModel(StudentInfo model)
        {
            ViewBag.ThongBao = "Id=" + model.Id + ", Name=" + model.Name + ", Marks=" + model.Marks;

            return View("Index");
        }

        public ActionResult UseArguments(String id, String name, double marks)
        {
            ViewBag.ThongBao = "Id=" + id + ", Name=" + name + ", Marks=" + marks;

            return View("Index");
        }

        public ActionResult UseFormCollection(FormCollection Fields)
        {
            String id = Fields["Id"];
            String name = Fields["Name"];
            double marks = Convert.ToDouble(Fields["Marks"]);

            ViewBag.ThongBao = "Id=" + id + ", Name=" + name + ", Marks=" + marks;

            return View("Index");
        }

        public ActionResult UseRequest()
        {
            String id = Request["Id"];
            String name = Request["Name"];
            double marks = Convert.ToDouble(Request["Marks"]);

            ViewBag.ThongBao = "Id=" + id + ", Name=" + name + ", Marks=" + marks;

            return View("Index");
        }
	}
}